using System;

using DesignByContract;

namespace Outcoding.GraphGenerator.Entities {
    public class Legend {
        
        #region Private Classes (1)
        
        private class Constants {
            public const LegendPosition DEFAULT_LEGEND_POSITION = LegendPosition.xlLegendPositionRight;
            public const bool DEFAULT_VISIBLE_VALUE = false;
            public const string DEFAULT_FONT_NAME = "Arial";
            public const int DEFAULT_FONT_SIZE = 12;
            public const bool DEFAULT_FONT_DECORATION_VALUE = false;
            public const string DEFAULT_FONT_COLOR = @"#000000";
        }

        #endregion

        #region Constructor

        public Legend() {
            mColor = Util.ColorTranslation(Constants.DEFAULT_FONT_COLOR);
        }

        #endregion

        private bool mIsVisible = Constants.DEFAULT_VISIBLE_VALUE;

        private LegendPosition mPosition = Constants.DEFAULT_LEGEND_POSITION;

        /// <summary>
        /// Is the Legend visible?
        /// </summary>
        public bool IsVisible {
            get {
                return mIsVisible;
            }
            set {
                mIsVisible = value;
            }
        }

        /// <summary>
        /// Legend Position within the chart.
        /// </summary>
	    public LegendPosition Position
	    {
		    get { 
                return mPosition;
            }
		    set { 
                mPosition = value;
            }
	    }

        private string mFontName = Constants.DEFAULT_FONT_NAME;

        private int mFontSize = Constants.DEFAULT_FONT_SIZE;

        private bool mIsFontBold = true;
        private bool mIsFontItalic = Constants.DEFAULT_FONT_DECORATION_VALUE;
        private bool mIsFontUnderline = Constants.DEFAULT_FONT_DECORATION_VALUE;

        public string FontName {
            get {
                return mFontName;
            }
            set {
                mFontName = value;
            }
        }

        public int FontSize {
            get {
                return mFontSize;
            }
            set {
                Check.Ensure(value > 0, "Size value cannot be less than zero.", new ArgumentOutOfRangeException());
                mFontSize = value;
            }
        }

        public bool IsFontBold {
            get {
                return mIsFontBold;
            }
            set {
                mIsFontBold = value;
            }
        }

        public bool IsFontItalic {
            get {
                return mIsFontItalic;
            }
            set {
                mIsFontItalic = value;
            }
        }

        public bool IsFontUnderline {
            get {
                return mIsFontUnderline;
            }
            set {
                mIsFontUnderline = value;
            }
        }

        private long mColor;

        public long Color
        {
            get { return mColor; }
            set { mColor = value; }
        }
    }
}
